home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue25 / icmp / ICMP.ZIP / PING / U_PING.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1997-07-02  |  1.8 KB  |  88 lines

  1. unit u_ping;
  2. (*@/// interface *)
  3. interface
  4.  
  5. (*@/// uses *)
  6. uses
  7.   Windows,
  8.   Messages,
  9.   SysUtils,
  10.   Classes,
  11.   Graphics,
  12.   Controls,
  13.   Forms,
  14.   Dialogs,
  15.   StdCtrls,
  16.   icmp,
  17.   ExtCtrls;
  18. (*@\\\0000000C01*)
  19.  
  20. type
  21. (*@///   Tfrm_ping = class(TForm) *)
  22. Tfrm_ping = class(TForm)
  23.   Ping: TPing;
  24.   lbl_host: TLabel;
  25.   edt_hostname: TEdit;
  26.   mem_out: TMemo;
  27.   btn_start: TButton;
  28.   btn_break: TButton;
  29.   Timer: TTimer;
  30.   procedure btn_startClick(Sender: TObject);
  31.   procedure PingPing(sender:TObject; status:Integer; ip,roundtime:Longint);
  32.   procedure btn_breakClick(Sender: TObject);
  33.   procedure TimerTimer(Sender: TObject);
  34. end;
  35. (*@\\\0000000A1D*)
  36.  
  37. var
  38.   frm_ping: Tfrm_ping;
  39. (*@\\\0000000301*)
  40. (*@/// implementation *)
  41. implementation
  42.  
  43. {$R *.DFM}
  44.  
  45. uses
  46.   ip_misc;
  47.  
  48. var
  49.   nr: integer;
  50.  
  51. (*@/// procedure Tfrm_ping.btn_startClick(Sender: TObject); *)
  52. procedure Tfrm_ping.btn_startClick(Sender: TObject);
  53. begin
  54.   ping.hostname:=edt_hostname.text;
  55.   mem_out.lines.clear;
  56.   nr:=0;
  57.   timer.enabled:=true;
  58.   end;
  59. (*@\\\*)
  60. (*@/// procedure Tfrm_ping.PingPing(sender:TObject; status:Integer; ip,roundtime:Longint); *)
  61. procedure Tfrm_ping.PingPing(sender:TObject; status:Integer; ip,roundtime:Longint);
  62. begin
  63.   inc(nr);
  64.   case status of
  65.     ip_success:
  66.       mem_out.lines.add(inttostr(nr)+'. '+inttostr(roundtime)+'ms');
  67.     else
  68.       mem_out.lines.add(inttostr(nr)+'. Failed')
  69.     end;
  70. end;
  71. (*@\\\003E000601000601000801000A01000709000709*)
  72. (*@/// procedure Tfrm_ping.btn_breakClick(Sender: TObject); *)
  73. procedure Tfrm_ping.btn_breakClick(Sender: TObject);
  74. begin
  75.   ping.terminate;
  76.   timer.enabled:=false;
  77.   end;
  78. (*@\\\*)
  79. (*@/// procedure Tfrm_ping.TimerTimer(Sender: TObject); *)
  80. procedure Tfrm_ping.TimerTimer(Sender: TObject);
  81. begin
  82.   ping.action;
  83.   end;
  84. (*@\\\*)
  85. (*@\\\0000000C31*)
  86. end.
  87. (*@\\\0001000011000301*)
  88.